<!DOCTYPE html>
<html>

<head lang="zh-cmn-Hans">
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
    <script type="text/javascript" src="dist/app.native.js"></script>
</head>

<body>
<script>
    setTimeout(function() {console.log(window.musicApi)}, 5000)

    function walk(father) {
        const obj = father ? musicApi[father] : musicApi
        const method = "api" + (father ? `.${father}` : "")
        const target = {
            tag: method
        }
        Object.keys(obj).forEach(function (key) {
            const item = obj[key]
            if (typeof item === 'function') {
                target[key] = function () {
                    const responseCallback = arguments[arguments.length - 1]
                    item(...arguments).then(function (data) {
                        responseCallback(data)
                    })
                }
            }
        })
        dsBridge.registerAsyn(method, target)
    }

    walk()
    walk('qq')
    walk('netease')
    walk('xiami')

</script>
</body>

</html>
